package junit;
/**
 * Description : 
 * @Author Evan Liu
 * @Date 2018年12月7日
 */

import java.util.ArrayList;
import java.util.List;

import com.netflix.loadbalancer.BaseLoadBalancer;
import com.netflix.loadbalancer.ILoadBalancer;
import com.netflix.loadbalancer.Server;

//https://www.cnblogs.com/cxxjohnson/p/9027919.html
public class BalancerApplication {
	public static void main(String[] args) {
		ILoadBalancer balancer=new BaseLoadBalancer();
		
		List<Server> servers = new ArrayList<Server>();
		servers.add(new Server("127.0.0.1",8091));
		servers.add(new Server("127.0.0.1",8092));
		balancer.addServers(servers);
		
		for(int i=0;i<10;i++) {
			Server choosedServer = balancer.chooseServer(null);
			System.out.println(choosedServer);
		}

	}
}


